#ifndef _SE_TIMER_
#define _SE_TIMER_

#include "Core/Math.hpp"

#include <thread>

namespace SE
{
    using Hours         = std::chrono::hours;
    using Minutes       = std::chrono::minutes;
    using Seconds       = std::chrono::seconds;
    using Milliseconds  = std::chrono::milliseconds;
    using Microseconds  = std::chrono::microseconds;
    using Nanoseconds   = std::chrono::nanoseconds;

    class Timer final
    {
    public:
        /// @brief Get the current time with the specified time type.
        /// @tparam _TimeTy Within Hours, Minutes, Seconds, Milliseconds, Microseconds, Nanoseconds of namespace SE.
        /// @return Unsigned 64-bit integer (or unsigned long long) precision of time.
        template <typename _TimeTy>
        static U64 Now()
        {
            return std::chrono::duration_cast<_TimeTy>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
        }

        /// @brief Sleep a duration with the specified type.
        /// @tparam _TimeTy Within Hours, Minutes, Seconds, Milliseconds, Microseconds, Nanoseconds of namespace SE.
        /// @param duration Duration to sleep with specified type.
        template <typename _TimeTy>
        static void Sleep(const _TimeTy& duration)
        {
            std::this_thread::sleep_for(duration);
        }
    };
} // !namespace SE

#endif // !_SE_TIMER_